<?php
include_once('common/header.php');
if($AppUI->id <=0 || !isset($_SERVER['HTTP_REFERER'])) {
	Vfriend_Function::redirect(HOST_VFRIEND);
}
$strRefer		= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$intPlaceId		= $objRequest->getParam('placeid', 0);
$intPimageId	= $objRequest->getParam('pimageid', 0);
$strToken		= $objRequest->getParam('token', '');
$strSession 	= Vfriend_Function::getSecret($intPimageId, SE_PLACE_DELETE_IMG);
if(Vfriend_Function::isValidLink($strRefer) && $strToken != '' && $strToken == $strSession) {
	Vfriend_Function::deleteSecret($intPimageId, SE_PLACE_DELETE_IMG);
	$objPlace	= new Place();
	$intError	= $objPlace->deleteImage($AppUI->id, $intPlaceId, $intPimageId);
	if($intError == 0) {
		Vfriend_Function::setMsg($arrMessage[10]);
	} else {
		$intError	= 17;
	}
} else {
	$intError	= 16;
}
if($intError > 0) {
	Vfriend_Function::setError($arrError[$intError]);	
}
if($strRefer == '') $strRefer = LINK_PLACE;
Vfriend_Function::redirect($strRefer);
?>
